package top.mccsdl.Acbot.entity;

import com.alibaba.fastjson2.JSONObject;

import java.util.Objects;

public class MediaMessage {

    // 文件的唯一标识符
    private String fileUuid;

    // 文件信息（可能是加密或编码后的字符串）
    private String fileInfo;

    // 生存时间（TTL），单位秒
    private long ttl;

    // 消息审计ID
    private String id;

    public MediaMessage() {}

    // 带参数的构造方法
    public MediaMessage(String fileUuid, String fileInfo, long ttl, String id) {
        this.fileUuid = fileUuid;
        this.fileInfo = fileInfo;
        this.ttl = ttl;
        this.id = id;
    }

    // Getter 方法
    public String getFileUuid() {
        return fileUuid;
    }

    public String getFileInfo() {
        return fileInfo;
    }

    public long getTtl() {
        return ttl;
    }

    public String getId() {
        return id;
    }

    // Setter 方法
    public void setFileUuid(String fileUuid) {
        this.fileUuid = fileUuid;
    }

    public void setFileInfo(String fileInfo) {
        this.fileInfo = fileInfo;
    }

    public void setTtl(long ttl) {
        this.ttl = ttl;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MediaMessage that = (MediaMessage) o;
        return ttl == that.ttl &&
                Objects.equals(fileUuid, that.fileUuid) &&
                Objects.equals(fileInfo, that.fileInfo) &&
                Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fileUuid, fileInfo, ttl, id);
    }

    public String toJsonStr(){
        return JSONObject.toJSONString(this);
    }
}
